serverName="proxy4j_1.0_server"
clientName="proxy4j_1.0_client"
jdkName="openjdk_win64.zip"
jdkSuffix="win64"


function copyJdk(){
  name=${1}
  zipName=${2}
  suffix=${3}
  mkdir ${name}_${suffix}
  cp ./${name}/* ./${name}_${suffix} -r
  unzip -d ./${name}_${suffix} ${zipName}
}

function zipJdk(){
  name=${1}
  suffix=${2}
  zip ${name}.zip ${name}/* -r
  zip ${name}_${suffix}.zip ${name}_${suffix}/* -r
}

# 打包
function target(){
  serverFolder=${1}
  clientFolder=${2}
  jdkZip=${3}
  os=${4}
  echo "复制Windows 客户端服务端..."
  copyJdk $serverFolder $jdkZip $os
  copyJdk $clientFolder $jdkZip $os
  echo "复制h2数据库文件"
  cp ./proxy.mv.db ./$serverFolder
  echo "压缩文件"
  zipJdk $serverFolder $os
  zipJdk $clientFolder $os
  echo "删除临时文件"
  rm -rf ${serverFolder}_${os}
  rm -rf ${clientFolder}_${os}
}
target "proxy4j_1.0_server" "proxy4j_1.0_client" "openjdk_win64.zip" "win64"
target "proxy4j_1.0_server" "proxy4j_1.0_client" "openjdk_mac64.zip" "mac64"